package com.avic.rong.goodsSort.api.secondListApi;

import com.avic.rong.api.HttpPostService;
import com.example.minato.minastore.BaseApi;
import com.example.minato.minastore.listener.HttpOnNextListener;
import com.trello.rxlifecycle2.components.support.RxAppCompatActivity;

import io.reactivex.Observable;
import retrofit2.Retrofit;

/**
 * Created by Chenjiaxin on 2019/7/24 14:10
 * E-Mail Address：16601203965@163.com
 */
public class GoodsSortSearchAllTsApi extends BaseApi {

    private String state;
    private int types;
    private String keyword;
    ////    private String catIds;
    private String attrPro ;
    private int typeId;
    private int sort;
//    private String postTime ;
    private int pageNo ;
    private int pageSize ;

    public GoodsSortSearchAllTsApi(RxAppCompatActivity rxAppCompatActivity, HttpOnNextListener listener, int types, int typeId, String state,String keyword, int pageNo, int pageSize) {
        super(rxAppCompatActivity, listener);
        this.types = types;
        this.typeId = typeId;
        this.state = state;
        this.keyword = keyword;
        this.pageNo = pageNo;
        this.pageSize = pageSize;
    }

    public GoodsSortSearchAllTsApi(RxAppCompatActivity rxAppCompatActivity, HttpOnNextListener listener, int types, int typeId, int sort, String state, String keyword) {
        super(rxAppCompatActivity, listener);
        this.types = types;
        this.typeId = typeId;
        this.sort = sort;
        this.state = state;
        this.keyword = keyword;
    }

    @Override
    public Observable getObservable(Retrofit retrofit) {
        HttpPostService service = retrofit.create(HttpPostService.class);
        if (state.equals("1"))
            return service.searchAllTs(types, typeId,keyword,pageNo,pageSize);
        else
            return service.searchAllTsTime(types, typeId, sort,keyword);
    }

}
